
package model;

import java.lang.Object;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import modelInterfaces.IResult;
import modelInterfaces.ITest;
import pluginInterfaces.IMetric;
import pluginInterfaces.IRecommender;

/**
 * Represents a set of algorithms and metrics, it is ultimately an 
 * instance that evaluates all the algorithms with all the metric.
 *
 * @author Andy
 */
public class Test implements ITest{
	
	/**
	 * Name this test.
	 */
    private String name;
    
    /**
     * Directory where you save the test (if applicable).
     */
    private String dirPath;
    
    /**
     * Result file name matches (to save).
     */
    private String outputFile;
    
    /**
     * List of metrics
     */
    private List<IMetric> metrics;
    
    /**
     * List of algorithms.
     */
    private List<IRecommender> algorithms;
    
    /**
     * Result test, after testing.
     */
    private Map<String, List<IResult>> resultMap;
    
    /**
     * Event type to evaluate.
     */
    private int eventType;
    
    public Test(){
    	this.resultMap = new HashMap<String, List<IResult>>();
    }

    public String getName(){
        return name;
    }

    public void setName(String name){
        this.name = name;
    }

    public void setMetrics(List<IMetric> metrics){
        this.metrics = metrics;
    }

    public void setAlgorithms(List<IRecommender> alg){
        this.algorithms = alg;
    }

    public List<IMetric> getMetrics(){
        return this.metrics;
    }

    public List<IRecommender> getAlgorithms(){
        return this.algorithms;
    }

	public String getOutputFile() {
		return outputFile;
	}

	public void setOutputFile(String outputFile) {
		this.outputFile = outputFile;
	}

	public String getDirPath() {
		return dirPath;
	}

	public void setDirPath(String dirPath) {
		this.dirPath = dirPath;
	}

	public int getEventType() {
		return eventType;
	}

	public void setEventType(int eventType) {
		this.eventType = eventType;
	}

	public Map<String, List<IResult>> getResultMap() {
		return resultMap;
	}

	public void setResultMap(Map<String, List<IResult>> resultMap) {
		this.resultMap = resultMap;
	}
	
	@Override
	public boolean equals(Object o) {
	    if (!(o instanceof ITest)) {
	      return false;
	    }
	    ITest other = (ITest) o;
	    return (name.equals(other.getName()));
	}
	
    public String toString(){
    	return this.name;
    }
}
